﻿using ID3;

namespace LastfmTopDownloader
{
    /// <summary>
    /// Harness for ID3,
    /// gratefully recived from
    /// sourceforge, or codeproject
    /// don't remember
    /// </summary>
    public class TagWorker
    {
        /// <summary>
        /// Set's ID3 tags,
        /// ID3v2 only
        /// </summary>
        /// <param name="path">Path to rhe file</param>
        /// <param name="artist">Artist name</param>
        /// <param name="title">Song name</param>
        internal void SetTags(string path, string artist, string title)
        {
            var sng = new ID3Info(path, true);
            sng.ID3v2Info.Load();
            sng.ID3v2Info.ClearAll();
            sng.ID3v2Info.SetTextFrame("TIT2", title);
            sng.ID3v2Info.SetTextFrame("TPE1", artist);
            sng.ID3v2Info.Save(3);
        }
    }
}
